<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * This license is also available via the world-wide-web at
 * http://itdapps.ncsu.edu/bsd.txt
 *
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to itappdev@ncsu.edu so we can send you a copy immediately.
 *
 * @package    Index_Controller
 * @category   Controller
 * @copyright  Copyright (c) 2007 NC State University Office of Information Technology
 * @license    http://itdapps.ncsu.edu/bsd.txt  BSD License
 * @version    SVN: $Id: $
 */

/**
 * Main controller for the application
 *
 * @package    Index_Controller
 * @category   Controller
 * @copyright  Copyright (c) 2007 NC State University Office of Information Technology
 */
class ViewController extends Zend_Controller_Action 
{   
          
          
    public function indexAction()
    {    	
    	
    	$get = Zend_Registry::get('getFilter');
			
		$gmailAcctId = $get->gad;
		$subCalendarName = $get->sub;
		$days = $get->d;
		$startTimestamp = strtotime($get->start);
		
		$events = new Google_Events();
		
		$rawEventData = $events->getRawEventData($subCalendarName, $startTimestamp, $days);
    	if(!empty($rawEventData)) {
			$this->view->rawEventData = $rawEventData;
		}
		
		$openHoursArray = $events->getUpcomingWeeklyEventSchedule($subCalendarName);
		if(!empty($openHoursArray)) {
			$this->view->openHoursArray = $openHoursArray;
		}

		$this->view->get = $get;
		$this->view->gmailAcctId = $gmailAcctId;
		$this->_helper->pageTitle('Calendar Display Options');
		
	}
	
}

